package menuBranch;
import javax.imageio.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.io.*;

public class test extends Component{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	BufferedImage tile;
	tileObject tileArray[][];
	
	
    public void paint(Graphics g) {
        g.drawImage(tile, 0, 0, null);
    }
    
    public test(int x, int y) {
		drawTiles dt = new drawTiles();
		tileArray = dt.drawMap();
	    tile=tileArray[y][x].getImage();
	    
     }
    public Dimension getPreferredSize() {
        if (tile == null) {
             return new Dimension(100,100);
        } else {
           return new Dimension(tile.getWidth(null), tile.getHeight(null));
       }
    }

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		JFrame screen = new JFrame();
		screen.setLayout(new GridLayout(25,40));
		screen.addWindowListener(new WindowAdapter(){
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
		screen.setSize(640,480);
		for(int i=0;i<25;i++){
			for(int j=0;j<40;j++){
				screen.add(new test(j,i));
			}
		}
        screen.pack();
        screen.setResizable(false);
		screen.setVisible(true);
	}
}
